package tech.heptagram.staff.cas.service.staff.impl;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

import lombok.extern.slf4j.Slf4j;
import tech.heptagram.staff.cas.domain.Area;
import tech.heptagram.staff.cas.service.staff.CasAreaService;

@Component
@Slf4j
public class CasAreaServiceImpl implements CasAreaService {

//    @Resource
//    private RestTemplate restTemplate;
//
//    @Resource
//    private UrlService urlService;

    @Override
    public List<Area> findAllCity() {

        List<Area> result = new ArrayList<>(4);
        result.add(new Area(21, "北京市"));
        result.add(new Area(22, "上海市"));
        result.add(new Area(23, "深圳市"));
        result.add(new Area(24, "广州市"));
//
//
//        String findAllCityApiUrl = urlService.getFindAllCitiesApiUri();
//
//        RequestEntity<Object> requestEntity = RequestEntity.post(URI.create(findAllCityApiUrl))
//                .accept(MediaType.APPLICATION_JSON)
//                .contentType(MediaType.APPLICATION_JSON)
//                .body(null);
//
//        ParameterizedTypeReference<ResponseResult<List<Area>>> typeReference = new ParameterizedTypeReference<ResponseResult<List<Area>>>() {};
//        ResponseEntity<ResponseResult<List<Area>>> resultEntity = restTemplate.exchange(requestEntity,typeReference);
//
//        log.info("请求查询城市列表接口返回结果:{}", resultEntity.getBody().toString());
//        if (resultEntity.getBody().getRetcode() != RestResultEnum.SUCCESS.getKey()){
//            throw new StaffCasException(resultEntity.getBody().getMsg());
//        }
//        return resultEntity.getBody().getData();

        return result;
    }
}
